import request from '@/utils/request.js'

export const getArticles = params => {
	return request({
		url: '/v1_0/articles',
		params
	})
}

export const getArticleById = articleId => {
	return request({
		url: `/v1_0/articles/${articleId}`
	})
}

export const addCollect = target => {
	return request({
		method: 'POST',
		url: '/v1_0/article/collections',
		data: {
			target
		}
	})
}

export const deleteCollect = target => {
	return request({
		method: 'DELETE',
		url: `/v1_0/article/collections/${target}`,
	})
}

export const addLike = target => {
	return request({
		method: "POST",
		url: '/v1_0/article/likings',
		data: {
			target
		}
	})
}

export const deleteLike = target => {
	return request({
		method: "DELETE",
		url: `/v1_0/article/likings/${target}`,
	})
}
